Add extra_headers support to OpenAIModelConfiguration#45687
Draft
jingjingjia-ms wants to merge 2 commits intoAzure:mainfrom
Draft
Add extra_headers support to OpenAIModelConfiguration#45687jingjingjia-ms wants to merge 2 commits intoAzure:mainfrom
jingjingjia-ms wants to merge 2 commits intoAzure:mainfrom
Conversation
|
Thank you for your contribution @jingjingjia-ms! We will review the pull request and get back to you soon. |
Add extra_headers field to OpenAIModelConfiguration TypedDict and merge it into per-call extra_headers in construct_prompty_model_config. This enables prompty-based evaluators to send custom HTTP headers (e.g., X-ModelType) required by OpenAI-compatible endpoints that need custom routing headers. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
831dd14 to
c0de83f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds an
extra_headersfield toOpenAIModelConfigurationTypedDict, enabling prompty-based evaluators to send custom HTTP headers on every LLM call. This unblocks integration with OpenAI-compatible endpoints that require custom routing headers.Changes
_model_configurations.py: Addextra_headers: NotRequired[Dict[str, str]]toOpenAIModelConfiguration_common/utils.py: Mergeextra_headersfrom model config into per-callextra_headersinconstruct_prompty_model_config()How it works
Customer headers are merged into the
extra_headersparameter onchat.completions.create(), which the OpenAI SDK merges after default headers - allowing override of any header includingAuthorization.